<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | 王勇程 <laughskydragon@qq.com>                         |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 积分管理控制器
 */
class Points extends AdminBase
{

    /**
     * 积分记录列表
     */
    public function list()
    {
        $where = $this->logicPoints->getWhere($this->param);
        
        $this->assign('list', $this->logicPoints->getPointsList($where));
        
        return $this->fetch('points_list');
    }
    
    /**
     * 积分调整
     */
    public function adjust()
    {
        IS_POST && $this->jump($this->logicPoints->pointsAdjust($this->param));
        
        return $this->fetch('points_adjust');
    }
    

    
    /**
     * 积分详情
     */
    public function detail()
    {
        $info = $this->logicPoints->getPointsInfo(['id' => $this->param['id']]);
        
        $this->assign('info', $info);
        
        return $this->fetch('points_detail');
    }
    
    /**
     * 积分规则设置
     */
    public function rules()
    {
        IS_POST && $this->jump($this->logicPoints->pointsRules($this->param));
        
        $this->assign('rules', $this->logicPoints->getPointsRules());
        
        return $this->fetch('points_rules');
    }
    
    /**
     * 积分统计
     */
    public function stats()
    {
        $this->assign('stats', $this->logicPoints->getPointsStats($this->param));
        
        return $this->fetch('points_stats');
    }
    
    /**
     * 积分导出
     */
    public function export()
    {
        $where = $this->logicPoints->getWhere($this->param);
        
        $this->logicPoints->exportPointsList($where);
    }
    
    /**
     * 积分商城管理
     */
    public function mall()
    {
        IS_POST && $this->jump($this->logicPoints->pointsMall($this->param));
        
        $this->assign('list', $this->logicPoints->getMallList());
        
        return $this->fetch('points_mall');
    }
    
    /**
     * 积分兑换记录
     */
    public function exchange()
    {
        $where = $this->logicPoints->getExchangeWhere($this->param);
        
        $this->assign('list', $this->logicPoints->getExchangeList($where));
        
        return $this->fetch('points_exchange');
    }
}